//
//  PersonalInforViewController.m
//  SouthChina
//
//  Created by Mr.Y on 14-10-9.
//  Copyright (c) 2014年 科创. All rights reserved.
//

#import "PersonalInforViewController.h"
#import "TakePhotoController.h"
#define LABEL_HEIGHT 20
#define LABEL_WIDTH 60

@interface PersonalInforViewController ()<UIActionSheetDelegate,UITextFieldDelegate,UITableViewDataSource,UITableViewDelegate,UIAlertViewDelegate>
{
    BOOL isprovincesBtn;
    NSString * provincesNum;
    NSString * cityNum;

    UISwitch *friendSwitchBtn;
    UISwitch *groupSwitchBtn;
    int scrollerViewHeight;

}
@property (strong, nonatomic) TakePhotoController * takephoto;
@property (strong, nonatomic) UIButton * headImageBtn;
@property (strong, nonatomic) UIImageView * headImage;//头像
@property (strong, nonatomic) UIScrollView * scrollView;
@property (strong, nonatomic) UIButton * submitBtn;//提交按钮
@property (strong, nonatomic) UIButton * provincesBtn;//省份
@property (strong, nonatomic) UIButton * cityBtn;//城市
@property (strong, nonatomic) UIControl * cityListView;
@property (strong, nonatomic) UITableView * cityListTableView;//城市列表
@property (strong, nonatomic) NSArray * provincesArr;
@property (strong, nonatomic) NSArray * cityArr;



@end


@implementation PersonalInforViewController

- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
    self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
    if (self) {
        _cityArr = [[NSArray alloc] init];
        _provincesArr = [[NSArray alloc] init];
        _provincesArr = [self getCitys];
        _scrollView = [[UIScrollView alloc] initWithFrame:CGRectMake(0, TITLE_BAR_HEGIHT+(YNEW), SCREEN_WIDTH, self.view.frame.size.height-64-50)];
        [self.view addSubview:_scrollView];
                
        UILabel * detailLabel = [[UILabel alloc] initWithFrame:CGRectMake(20, 10, 80, LABEL_HEIGHT)];
        detailLabel.text = @"详细信息";
        [detailLabel setFont:[UIFont fontWithName:@"Helvetica-Bold" size:17]];
        [_scrollView addSubview:detailLabel];
        
        UIView *line2 = [[UIImageView alloc] init];
        [line2 setBackgroundColor:[UIColor lightGrayColor]];
        line2.frame = CGRectMake(10, detailLabel.frame.origin.y+25, (SCREEN_WIDTH)-20, 1.0f);
        [_scrollView addSubview:line2];
        
        UIView * backView1 = [[UIView alloc] initWithFrame:CGRectMake(10, 15+line2.frame.origin.y, SCREEN_WIDTH-20, 40)];
        [backView1 setBackgroundColor:[UIColor whiteColor]];
        [_scrollView addSubview:backView1];
        UILabel * groupLabel = [[UILabel alloc] initWithFrame:CGRectMake(20, 10, 80, LABEL_HEIGHT)];
        groupLabel.text = @"群组可见";
        [groupLabel setFont:[UIFont systemFontOfSize:15.0f]];
        [backView1 addSubview:groupLabel];
        groupSwitchBtn = [[UISwitch alloc] initWithFrame:CGRectMake(220, 5, 20, 20)];
        [groupSwitchBtn addTarget:self action:nil forControlEvents:UIControlEventValueChanged];
        [backView1 addSubview:groupSwitchBtn];
        
        UIView * backView2 = [[UIView alloc] initWithFrame:CGRectMake(10, 10+backView1.frame.size.height+backView1.frame.origin.y, SCREEN_WIDTH-20, 40)];
        [backView2 setBackgroundColor:[UIColor whiteColor]];
        [_scrollView addSubview:backView2];
        UILabel * friendLabel = [[UILabel alloc] initWithFrame:CGRectMake(20, 10, 80, LABEL_HEIGHT)];
        friendLabel.text = @"好友可见";
        [friendLabel setFont:[UIFont systemFontOfSize:15.0f]];
        [backView2 addSubview:friendLabel];
        friendSwitchBtn = [[UISwitch alloc] initWithFrame:CGRectMake(220, 5, 20, 10)];
        [friendSwitchBtn addTarget:self action:nil forControlEvents:UIControlEventValueChanged];
        [backView2 addSubview:friendSwitchBtn];
        NSString * linkinfostate = [DE getGlobalVar:[NSString stringWithFormat:@"%@%@",DE.userId,LINKINFOSTATE]];
        // 1、好友可以见 2 群组可以见（除好友，陌生人）3 任何人都可见 0 任何人都不可见
        if ([@"1" isEqualToString:linkinfostate]) {
            [friendSwitchBtn setOn:YES];
            [groupSwitchBtn setOn:NO];

        } else if ([@"2" isEqualToString:linkinfostate]) {
            [friendSwitchBtn setOn:NO];
            [groupSwitchBtn setOn:YES];

        } else if ([@"0" isEqualToString:linkinfostate]) {
            [friendSwitchBtn setOn:NO];
            [groupSwitchBtn setOn:NO];

        } else {
            [friendSwitchBtn setOn:YES];
            [groupSwitchBtn setOn:YES];

        }
        
        UILabel * setNameLabel = [[UILabel alloc] initWithFrame:CGRectMake(30,backView2.frame.origin.y+20+backView2.frame.size.height, LABEL_WIDTH, LABEL_HEIGHT)];
        setNameLabel.text = @"昵称：";
        [setNameLabel setFont:[UIFont systemFontOfSize:15.0f]];
        [setNameLabel setTextColor:[UIColor lightGrayColor]];
        [_scrollView addSubview:setNameLabel];
        
        _setNameText = [[UITextField alloc] initWithFrame:CGRectMake(30+LABEL_WIDTH,backView2.frame.origin.y+15+backView2.frame.size.height, SCREEN_WIDTH-LABEL_WIDTH-50, 30)];
        _setNameText.text =[DE getGlobalVar:LOGIN_USER_NICKNAME]==nil?@"":[DE getGlobalVar:LOGIN_USER_NICKNAME];
        _setNameText.borderStyle=UITextBorderStyleRoundedRect;
        _setNameText.delegate = self;
        _setNameText.tag = 96;
        [_scrollView addSubview:_setNameText];
        
        UILabel * setPhoneLabel = [[UILabel alloc] initWithFrame:CGRectMake(30,setNameLabel.frame.origin.y+20+LABEL_HEIGHT, LABEL_WIDTH, LABEL_HEIGHT)];
        setPhoneLabel.text = @"手机：";
        [setPhoneLabel setFont:[UIFont systemFontOfSize:15.0f]];
        [setPhoneLabel setTextColor:[UIColor lightGrayColor]];
        [_scrollView addSubview:setPhoneLabel];
        
        _setPhoneText = [[UITextField alloc] initWithFrame:CGRectMake(30+LABEL_WIDTH,setNameLabel.frame.origin.y+15+LABEL_HEIGHT, SCREEN_WIDTH-LABEL_WIDTH-50, 30)];
        _setPhoneText.text = [DE getGlobalVar:LOGIN_USER_MOBILE]== nil?@"":[DE getGlobalVar:LOGIN_USER_MOBILE];
        _setPhoneText.borderStyle=UITextBorderStyleRoundedRect;
        _setPhoneText.delegate = self;
        _setPhoneText.tag = 97;
        [_scrollView addSubview:_setPhoneText];

        UILabel * setQQLabel = [[UILabel alloc] initWithFrame:CGRectMake(30,setPhoneLabel.frame.origin.y+20+LABEL_HEIGHT, LABEL_WIDTH, LABEL_HEIGHT)];
        setQQLabel.text = @"QQ：";
        [setQQLabel setFont:[UIFont systemFontOfSize:15.0f]];
        [setQQLabel setTextColor:[UIColor lightGrayColor]];
        [_scrollView addSubview:setQQLabel];
        
        _setQQText = [[UITextField alloc] initWithFrame:CGRectMake(30+LABEL_WIDTH,setPhoneLabel.frame.origin.y+15+LABEL_HEIGHT, SCREEN_WIDTH-LABEL_WIDTH-50, 30)];
        _setQQText.text =[DE getGlobalVar:LOGIN_USER_QQ]== nil?@"":[DE getGlobalVar:LOGIN_USER_QQ];
        _setQQText.borderStyle=UITextBorderStyleRoundedRect;
        _setQQText.delegate = self;
        _setQQText.tag = 98;
        [_scrollView addSubview:_setQQText];
        
        UILabel * setProvincesLabel = [[UILabel alloc] initWithFrame:CGRectMake(30,setQQLabel.frame.origin.y+20+LABEL_HEIGHT, LABEL_WIDTH, LABEL_HEIGHT)];
        setProvincesLabel.text = @"省份：";
        [setProvincesLabel setFont:[UIFont systemFontOfSize:15.0f]];
        [setProvincesLabel setTextColor:[UIColor lightGrayColor]];
        [_scrollView addSubview:setProvincesLabel];
        
        _provincesBtn = [[UIButton alloc] initWithFrame:CGRectMake(30+LABEL_WIDTH, setQQLabel.frame.origin.y+15+LABEL_HEIGHT, SCREEN_WIDTH-LABEL_WIDTH-50, 30)];
        [_provincesBtn addTarget:self action:@selector(provincesBtn:) forControlEvents:UIControlEventTouchUpInside];
        provincesNum =[DE getGlobalVar:LOGIN_USER_PROV]==nil?@"":[DE getGlobalVar:LOGIN_USER_PROV];
        NSString * provincesName = @"";
       cityNum =[DE getGlobalVar:LOGIN_USER_CITY]==nil?@"":[DE getGlobalVar:LOGIN_USER_CITY];
        NSString * cityName = @"";
        for (NSDictionary * dic in _provincesArr) {
            if ([[dic objectForKey:@"code"]isEqualToString:provincesNum]) {
                provincesName =[dic objectForKey:@"name"];
                _cityArr = [dic objectForKey:@"cities"];
                for (NSDictionary * dic in _cityArr) {
                    if ([[dic objectForKey:@"code"]isEqualToString:cityNum]) {
                        cityName =[dic objectForKey:@"name"];
                        break;
                    }
                }
                break;
            }
        }
        [_provincesBtn setTitle:[provincesName isEqualToString:@""]?@"请选择省份":provincesName forState:UIControlStateNormal];
        _provincesBtn.titleLabel.font = [UIFont systemFontOfSize:14.0f];
        [_provincesBtn setBackgroundColor:[UIColor lightGrayColor]];
        [_scrollView addSubview:_provincesBtn];
        
        UILabel * setCityLabel = [[UILabel alloc] initWithFrame:CGRectMake(30,setProvincesLabel.frame.origin.y+20+LABEL_HEIGHT, LABEL_WIDTH, LABEL_HEIGHT)];
        setCityLabel.text = @"城市：";
        [setCityLabel setFont:[UIFont systemFontOfSize:15.0f]];
        [setCityLabel setTextColor:[UIColor lightGrayColor]];
        [_scrollView addSubview:setCityLabel];
        

        
        _cityBtn = [[UIButton alloc] initWithFrame:CGRectMake(30+LABEL_WIDTH, setProvincesLabel.frame.origin.y+15+LABEL_HEIGHT, SCREEN_WIDTH-LABEL_WIDTH-50, 30)];
        [_cityBtn addTarget:self action:@selector(cityBtn:) forControlEvents:UIControlEventTouchUpInside];
        
        [_cityBtn setTitle:[cityName isEqualToString:@""]?@"请选择城市":cityName forState:UIControlStateNormal];
        _cityBtn.titleLabel.font = [UIFont systemFontOfSize:14.0f];
        [_cityBtn setBackgroundColor:[UIColor lightGrayColor]];
        [_scrollView addSubview:_cityBtn];
        
        UILabel * setAddressLabel = [[UILabel alloc] initWithFrame:CGRectMake(30,setCityLabel.frame.origin.y+20+LABEL_HEIGHT, LABEL_WIDTH, LABEL_HEIGHT)];
        setAddressLabel.text = @"地址：";
        [setAddressLabel setFont:[UIFont systemFontOfSize:15.0f]];
        [setAddressLabel setTextColor:[UIColor lightGrayColor]];
        [_scrollView addSubview:setAddressLabel];
        
        _setAddressText = [[UITextField alloc] initWithFrame:CGRectMake(30+LABEL_WIDTH,setCityLabel.frame.origin.y+15+LABEL_HEIGHT, SCREEN_WIDTH-LABEL_WIDTH-50, 30)];
        _setAddressText.text = [DE getGlobalVar:LOGIN_USER_ADDRESS]==nil?@"":[DE getGlobalVar:LOGIN_USER_ADDRESS];
        _setAddressText.borderStyle=UITextBorderStyleRoundedRect;
        _setAddressText.delegate = self;
        _setAddressText.tag = 99;
        [_scrollView addSubview:_setAddressText];

        
        UILabel * setTelLabel = [[UILabel alloc] initWithFrame:CGRectMake(30,setAddressLabel.frame.origin.y+20+LABEL_HEIGHT, LABEL_WIDTH, LABEL_HEIGHT)];
        setTelLabel.text = @"固话：";
        [setTelLabel setFont:[UIFont systemFontOfSize:15.0f]];
        [setTelLabel setTextColor:[UIColor lightGrayColor]];
        [_scrollView addSubview:setTelLabel];
        
        _setTelText = [[UITextField alloc] initWithFrame:CGRectMake(30+LABEL_WIDTH,setAddressLabel.frame.origin.y+15+LABEL_HEIGHT, SCREEN_WIDTH-LABEL_WIDTH-50, 30)];
        _setTelText.text = [DE getGlobalVar:LOGIN_USER_HOMETEL]==nil?@"":[DE getGlobalVar:LOGIN_USER_HOMETEL];
        _setTelText.borderStyle=UITextBorderStyleRoundedRect;
        _setTelText.delegate = self;
        _setTelText.tag = 100;
        [_scrollView addSubview:_setTelText];

        UILabel * setEmailLabel = [[UILabel alloc] initWithFrame:CGRectMake(30,setTelLabel.frame.origin.y+20+LABEL_HEIGHT, LABEL_WIDTH, LABEL_HEIGHT)];
        setEmailLabel.text = @"邮件：";
        setEmailLabel.numberOfLines = 0;
        [setEmailLabel setFont:[UIFont systemFontOfSize:15.0f]];
        [setEmailLabel setTextColor:[UIColor lightGrayColor]];
        [_scrollView addSubview:setEmailLabel];
        
        _setEmailText = [[UITextField alloc] initWithFrame:CGRectMake(30+LABEL_WIDTH,setTelLabel.frame.origin.y+15+LABEL_HEIGHT, SCREEN_WIDTH-LABEL_WIDTH-50, 30)];
        _setEmailText.text = [DE getGlobalVar:LOGIN_USER_EMAIL]==nil?@"":[DE getGlobalVar:LOGIN_USER_EMAIL];
        _setEmailText.borderStyle=UITextBorderStyleRoundedRect;
        _setEmailText.delegate = self;
        _setEmailText.tag = 101;
        [_scrollView addSubview:_setEmailText];
        
        UIImage *img=[UIImage imageNamed:@"blue_btn_normal.png"];
        img=[img stretchableImageWithLeftCapWidth:20 topCapHeight:20];
        _submitBtn = [[UIButton alloc] initWithFrame:CGRectMake(20, self.view.frame.size.height-45, SCREEN_WIDTH-40, 40)];
        [_submitBtn addTarget:self action:@selector(submitBtn:) forControlEvents:UIControlEventTouchUpInside];
        [_submitBtn setTitle:@"提交" forState:UIControlStateNormal];
        [_submitBtn setBackgroundImage:img forState:UIControlStateNormal];
        [self.view addSubview:_submitBtn];
        
        _scrollView.bounces = NO;
        [_scrollView setBackgroundColor:[UIColor groupTableViewBackgroundColor]];
        [_scrollView setShowsHorizontalScrollIndicator:NO];
        [_scrollView setShowsVerticalScrollIndicator:NO];
        _scrollView.contentSize = CGSizeMake(SCREEN_WIDTH, setEmailLabel.frame.origin.y+setEmailLabel.frame.size.height+20);
        scrollerViewHeight = setEmailLabel.frame.origin.y+setEmailLabel.frame.size.height+20+50;
        //城市列表
        _cityListView = [[UIControl alloc] initWithFrame:CGRectMake(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT)];
        [_cityListView setBackgroundColor:[UIColor colorWithRed:226.0/255.0 green:231.0/255.0 blue:237.0/255.0 alpha:0.5]];
        [_cityListView addTarget:self
                         action:@selector(myActionmethod:)
               forControlEvents:UIControlEventTouchUpInside ];
        _cityListTableView = [[UITableView alloc] initWithFrame:CGRectMake(60, TITLE_BAR_HEGIHT+(YNEW), SCREEN_WIDTH-120, SCREEN_HEIGHT-100) style:UITableViewStylePlain];
        _cityListTableView.delegate = self;
        _cityListTableView.dataSource = self;
        [_cityListView addSubview:_cityListTableView];
        
        

    }
    return self;
}

- (void)viewDidLoad
{
    [super viewDidLoad];
    [self addTitleBarWithBackBtn:@"个人信息" needReturn:YES];

    // Do any additional setup after loading the view.
}

- (void)didReceiveMemoryWarning
{
    [super didReceiveMemoryWarning];
    
    // Dispose of any resources that can be recreated.
}
-(void)provincesBtn:(id)sender
{
    isprovincesBtn = YES;
    [self.view addSubview:_cityListView];
    [_cityListTableView reloadData];
}
-(void)cityBtn:(id)sender
{
    if ([_provincesBtn.titleLabel.text isEqualToString:@"请选择省份"]) {
        UIAlertView * alert = [[UIAlertView alloc] initWithTitle:@"提示" message:@"请先选择省份" delegate:self cancelButtonTitle:@"确定" otherButtonTitles: nil];
        [alert show];
        return;
    }else{
        [self.view addSubview:_cityListView];
        isprovincesBtn = NO;
        [_cityListTableView reloadData];
    }
    
}

- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
{
    return 1;
}
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
    if (isprovincesBtn == YES) {
        return _provincesArr.count;

    }else
    {
        return _cityArr.count;
    }
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
    static NSString * CellIdentifier = @"Cell";
    UITableViewCell * cell = [tableView dequeueReusableHeaderFooterViewWithIdentifier:CellIdentifier];
    if (!cell) {
        cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier];
    }
    cell.textLabel.font = [UIFont boldSystemFontOfSize:15.0f];
    if (isprovincesBtn == YES) {
        cell.textLabel.text =[[_provincesArr objectAtIndex:indexPath.row] objectForKey:@"name"];

    }else
    {
        cell.textLabel.text = [[_cityArr objectAtIndex:indexPath.row] objectForKey:@"name"];
    }
    return cell;
}
-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
    if (isprovincesBtn == YES) {
        [_provincesBtn setTitle:[[_provincesArr objectAtIndex:indexPath.row] objectForKey:@"name"] forState:UIControlStateNormal];
        _cityArr =[[_provincesArr objectAtIndex:indexPath.row] objectForKey:@"cities"];
        [_cityBtn setTitle:[[_cityArr objectAtIndex:0] objectForKey:@"name"]forState:UIControlStateNormal];
        provincesNum = [[_provincesArr objectAtIndex:indexPath.row] objectForKey:@"code"];
        cityNum = [[_cityArr objectAtIndex:0] objectForKey:@"code"];


    }else
    {
        [_cityBtn setTitle:[[_cityArr objectAtIndex:indexPath.row] objectForKey:@"name"]forState:UIControlStateNormal];
        cityNum = [[_cityArr objectAtIndex:indexPath.row] objectForKey:@"code"];

    }
    [_cityListView removeFromSuperview];
    
}

-(void)myActionmethod:(id)sender
{
    [_cityListView removeFromSuperview];
    
}
-(void)submitBtn:(id)sender
{
    NSLog(@"submitBtn");
    NSString * linkStat = @"";
    
    bool isGroupButtonOn = [groupSwitchBtn isOn];
    bool isFriendButtonOn = [friendSwitchBtn isOn];
    
    
    if (isGroupButtonOn && isFriendButtonOn) {
        linkStat = @"3";
    }else if (isGroupButtonOn && !isFriendButtonOn)
    {
        linkStat = @"2";
    }else if (!isGroupButtonOn && isFriendButtonOn)
    {
        linkStat = @"1";
    }else
    {
        linkStat = @"0";
    }

    NSDictionary *params = @{@"fixedTel":_setTelText.text,@"phone":_setPhoneText.text,@"qq":_setQQText.text,@"email":_setEmailText.text,@"address":_setAddressText.text,@"nickName":_setNameText.text,@"prov":provincesNum==nil?@"":provincesNum,@"city":cityNum==nil?@"":cityNum,@"linkInfoState":linkStat};
    
    [MBProgressHUD showHUDAddedTo:self.view animated:YES];

    [DE serverCall:@"updateUserInfo" params:params callback:^(BOOL success, int code, NSString *desc, NSDictionary *data,NSDictionary*param) {
        UIAlertView *view = [[UIAlertView alloc]initWithTitle:@"提示" message:@"" delegate:self cancelButtonTitle:@"确定" otherButtonTitles:nil, nil];
        [MBProgressHUD hideHUDForView:self.view animated:YES];
        if(success && [data objectForKey:@"result"])
        {
            [DE setGlobalVar:LOGIN_USER_HOMETEL value:_setTelText.text];
            [DE setGlobalVar:LOGIN_USER_MOBILE value:_setPhoneText.text];
            [DE setGlobalVar:LOGIN_USER_EMAIL value:_setEmailText.text];
            [DE setGlobalVar:LOGIN_USER_ADDRESS value:_setAddressText.text];
            [DE setGlobalVar:LOGIN_USER_NICKNAME value:_setNameText.text];
            [DE setGlobalVar:LINKINFOSTATE value:linkStat];
            [DE setGlobalVar:LOGIN_USER_QQ value:_setQQText.text];
            [DE setGlobalVar:LOGIN_USER_PROV value:provincesNum];
            [DE setGlobalVar:LOGIN_USER_CITY value:cityNum];
            view.message = @"信息提交成功！！";
            [view show];

        }else
        {
            view.message = @"信息提交失败！！";
            [view show];

        }
        
    }];

    
}

- (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex{
    
}
- (BOOL)textFieldShouldBeginEditing:(UITextField *)textField
{
//    if (textField.tag <99 &&textField.tag>96) {
//        [_scrollView setContentOffset:CGPointMake(0, 100) animated:YES];
//    }
//    if (textField.tag == 99 ) {
//       [_scrollView setContentOffset:CGPointMake(0, 240) animated:YES];
//    }
//    if (textField.tag == 100 ) {
//        [_scrollView setContentOffset:CGPointMake(0, 280) animated:YES];
//    }if (textField.tag == 101 ) {
//        [_scrollView setContentOffset:CGPointMake(0, 320) animated:YES];
//    }
    
    _scrollView.contentSize = CGSizeMake(SCREEN_WIDTH,scrollerViewHeight+140);
    return YES;
}
- (BOOL)textFieldShouldReturn:(UITextField *)textField
{
    [self.view endEditing:YES];
//
//    if (textField.tag>96&&textField.tag<98) {
//        [_scrollView setContentOffset:CGPointMake(0, 30) animated:YES];
//    }
//    if (textField.tag>96&&textField.tag<98) {
//        [_scrollView setContentOffset:CGPointMake(0, 60) animated:YES];
//    }
    _scrollView.contentSize = CGSizeMake(SCREEN_WIDTH,scrollerViewHeight);

    return YES;
}

//城市列表
- (NSArray * )getCitys {
    NSString * filePath = [[NSBundle mainBundle] pathForResource:@"cities_json"
                                                          ofType:@"txt"
                                                     inDirectory:nil];
    NSData * dd = [NSData dataWithContentsOfFile:filePath];
    NSArray * aray= [NSArray arrayWithArray:[NSJSONSerialization JSONObjectWithData:dd options:NSJSONReadingMutableContainers error:nil]];
    
    return aray;
}
@end
